﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;

namespace Nature.Data.CkMarkup
{
	using Nature.Text;
	


	public partial class CkTextSource : TextSource
	{
		public CkTextSource(string text) : base(text) 
        {
            base.Initialize(); 
        }
	}

	[TextSource(typeof(CkTextSource))]
	public partial class CkTextFragment : TextFragment
	{
		protected static readonly TraceSource TextTrace = new TraceSource("CkTextSource", SourceLevels.Critical);

		public CkTextFragment(CkTextSource source) : 
			base(source) { this.CkTextSource  = source; }

		protected CkTextFragment(CkTextSource source, System.Text.RegularExpressions.Capture capture) : 
			base(source, capture) { this.CkTextSource  = source; }

		protected  CkTextFragment(CkTextSource source, int index, int length) : 
			base(source, index, length) { this.CkTextSource  = source; }

		public CkTextSource CkTextSource { get; private set; }

		internal class TextProgressArg : IDisposable 
		{			
            private Dictionary<string, string> m_stringsMap = new Dictionary<string, string>();
			internal readonly Stack<string> Stack = new Stack<string>();
			internal readonly ITextInfoEventListener Listener;

			internal string LogicalPath
			{
				get
				{
					StringBuilder sb = new StringBuilder();
					foreach(string node in this.Stack) { sb.AppendFormat("/{0}", node); }
					return sb.ToString();
				}
			}

			public TextProgressArg(CkTextSource source, ITextInfoEventListener listener)
			{
				this.Source = source;
				this.Listener = listener;
			}

			public CkTextSource Source
			{
				get;
				private set;
			}

            public string MapString(string s)
            {
                string mapped = s;
                if( m_stringsMap.TryGetValue(s, out mapped))
                {
                    return mapped;
                }
                else
                {
                    m_stringsMap.Add(s, s);
                }
                return s;
            }
        
			#region IDisposable Members

			void IDisposable.Dispose()
			{

			}

			#endregion
		}
	}

    

     
    /// <summary>
    /// CkThermoSetOptions
    /// </summary>
    public enum ThermoSetOptions
    {  
        /// <summary>
        /// All
        /// </summary>
        All  
    }

    public partial class CkThermoSetOptions : CkTextFragment
    {  
        public static readonly Regex AllRegex = new Regex(@"^\s*(?:all)\s*$", RegexOptions.Compiled);  

		public CkThermoSetOptions(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkThermoSetOptions(TextProgressArg arg) : base(arg.Source) { Initialize(arg); }        
		internal CkThermoSetOptions(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkThermoSetOptions(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

        public ThermoSetOptions ThermoSetOptions { get; private set; }

        void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
            if(false){}  
            else if( AllRegex.IsMatch(this) ){ this.ThermoSetOptions = ThermoSetOptions.All; }  
            else
            { 
                listener.Submit(TextInfoType.Error, "Invalid format", this);  
            }
        }
    }

     
    /// <summary>
    /// CkThermoPhase
    /// </summary>
    public enum PhaseType
    {  
        /// <summary>
        /// Gas
        /// </summary>
        Gas,  
        /// <summary>
        /// Liquid
        /// </summary>
        Liquid,  
        /// <summary>
        /// Solid
        /// </summary>
        Solid  
    }

    public partial class CkThermoPhase : CkTextFragment
    {  
        public static readonly Regex GasRegex = new Regex(@"^\s*(?:^\s*g\s*$)\s*$", RegexOptions.Compiled);  
        public static readonly Regex LiquidRegex = new Regex(@"^\s*(?:^\s*l\s*$)\s*$", RegexOptions.Compiled);  
        public static readonly Regex SolidRegex = new Regex(@"^\s*(?:^\s*s\s*$)\s*$", RegexOptions.Compiled);  

		public CkThermoPhase(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkThermoPhase(TextProgressArg arg) : base(arg.Source) { Initialize(arg); }        
		internal CkThermoPhase(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkThermoPhase(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

        public PhaseType PhaseType { get; private set; }

        void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
            if(false){}  
            else if( GasRegex.IsMatch(this) ){ this.PhaseType = PhaseType.Gas; }  
            else if( LiquidRegex.IsMatch(this) ){ this.PhaseType = PhaseType.Liquid; }  
            else if( SolidRegex.IsMatch(this) ){ this.PhaseType = PhaseType.Solid; }  
            else
            { 
                listener.Submit(TextInfoType.Error, @"Expected phase id like e.g. 'g', 'l' or 's'", this);  
            }
        }
    }

     
    /// <summary>
    /// CkReactionSetOptions
    /// </summary>
    public enum ReactionSetOptions
    {  
        /// <summary>
        /// Applied if any of the reactions do not conserve the number of surface sites of a given type
        /// </summary>
        NonCon,  
        /// <summary>
        /// Specifies that the Motz-Wise correction is to be used for all sticking-coefficient reactions (the default).
        /// </summary>
        MwOn,  
        /// <summary>
        /// Tursn off the Motz-Wise correction for all sticking coefficient reactions
        /// </summary>
        MwOff  
    }

    public partial class CkReactionSetOptions : CkTextFragment
    {  
        public static readonly Regex NonConRegex = new Regex(@"^\s*(?:noncon)\s*$", RegexOptions.Compiled);  
        public static readonly Regex MwOnRegex = new Regex(@"^\s*(?:mwon)\s*$", RegexOptions.Compiled);  
        public static readonly Regex MwOffRegex = new Regex(@"^\s*(?:mwoff)\s*$", RegexOptions.Compiled);  

		public CkReactionSetOptions(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkReactionSetOptions(TextProgressArg arg) : base(arg.Source) { Initialize(arg); }        
		internal CkReactionSetOptions(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkReactionSetOptions(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

        public ReactionSetOptions ReactionSetOptions { get; private set; }

        void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
            if(false){}  
            else if( NonConRegex.IsMatch(this) ){ this.ReactionSetOptions = ReactionSetOptions.NonCon; }  
            else if( MwOnRegex.IsMatch(this) ){ this.ReactionSetOptions = ReactionSetOptions.MwOn; }  
            else if( MwOffRegex.IsMatch(this) ){ this.ReactionSetOptions = ReactionSetOptions.MwOff; }  
            else
            { 
                listener.Submit(TextInfoType.Error, "Invalid format", this);  
            }
        }
    }

     
    /// <summary>
    /// CkReactionEnergyUnits
    /// </summary>
    public enum ReactionEnergyUnits
    {  
        /// <summary>
        /// Calorie
        /// </summary>
        Calorie,  
        /// <summary>
        /// KiloCalorie
        /// </summary>
        KiloCalorie,  
        /// <summary>
        /// Joule
        /// </summary>
        Joule  
    }

    public partial class CkReactionEnergyUnits : CkTextFragment
    {  
        public static readonly Regex CalorieRegex = new Regex(@"^\s*(?:cal)\s*$", RegexOptions.Compiled);  
        public static readonly Regex KiloCalorieRegex = new Regex(@"^\s*(?:kcal)\s*$", RegexOptions.Compiled);  
        public static readonly Regex JouleRegex = new Regex(@"^\s*(?:joules?)\s*$", RegexOptions.Compiled);  

		public CkReactionEnergyUnits(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkReactionEnergyUnits(TextProgressArg arg) : base(arg.Source) { Initialize(arg); }        
		internal CkReactionEnergyUnits(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkReactionEnergyUnits(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

        public ReactionEnergyUnits ReactionEnergyUnits { get; private set; }

        void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
            if(false){}  
            else if( CalorieRegex.IsMatch(this) ){ this.ReactionEnergyUnits = ReactionEnergyUnits.Calorie; }  
            else if( KiloCalorieRegex.IsMatch(this) ){ this.ReactionEnergyUnits = ReactionEnergyUnits.KiloCalorie; }  
            else if( JouleRegex.IsMatch(this) ){ this.ReactionEnergyUnits = ReactionEnergyUnits.Joule; }  
            else
            { 
                listener.Submit(TextInfoType.Error, "Invalid format", this);  
            }
        }
    }

     
    /// <summary>
    /// CkReactionMolAmountUnits
    /// </summary>
    public enum ReactionMolAmountUnits
    {  
        /// <summary>
        /// Mole
        /// </summary>
        Mole,  
        /// <summary>
        /// KiloMole
        /// </summary>
        KiloMole,  
        /// <summary>
        /// Molecule
        /// </summary>
        Molecule  
    }

    public partial class CkReactionMolAmountUnits : CkTextFragment
    {  
        public static readonly Regex MoleRegex = new Regex(@"^\s*(?:moles?)\s*$", RegexOptions.Compiled);  
        public static readonly Regex KiloMoleRegex = new Regex(@"^\s*(?:kmoles?)\s*$", RegexOptions.Compiled);  
        public static readonly Regex MoleculeRegex = new Regex(@"^\s*(?:molecules?)\s*$", RegexOptions.Compiled);  

		public CkReactionMolAmountUnits(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkReactionMolAmountUnits(TextProgressArg arg) : base(arg.Source) { Initialize(arg); }        
		internal CkReactionMolAmountUnits(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkReactionMolAmountUnits(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

        public ReactionMolAmountUnits ReactionMolAmountUnits { get; private set; }

        void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
            if(false){}  
            else if( MoleRegex.IsMatch(this) ){ this.ReactionMolAmountUnits = ReactionMolAmountUnits.Mole; }  
            else if( KiloMoleRegex.IsMatch(this) ){ this.ReactionMolAmountUnits = ReactionMolAmountUnits.KiloMole; }  
            else if( MoleculeRegex.IsMatch(this) ){ this.ReactionMolAmountUnits = ReactionMolAmountUnits.Molecule; }  
            else
            { 
                listener.Submit(TextInfoType.Error, "Invalid format", this);  
            }
        }
    }

     
    /// <summary>
    /// CkReactionActivationEnergyUnits
    /// </summary>
    public enum ActivationEnergyUnits
    {  
        /// <summary>
        /// CalMole
        /// </summary>
        CalMole,  
        /// <summary>
        /// KiloCalMole
        /// </summary>
        KiloCalMole,  
        /// <summary>
        /// JouleMole
        /// </summary>
        JouleMole,  
        /// <summary>
        /// Kelvin
        /// </summary>
        Kelvin  
    }

    public partial class CkReactionActivationEnergyUnits : CkTextFragment
    {  
        public static readonly Regex CalMoleRegex = new Regex(@"^\s*(?:cal\s*[/]\s*mole)\s*$", RegexOptions.Compiled);  
        public static readonly Regex KiloCalMoleRegex = new Regex(@"^\s*(?:kcal\s*[/]\s*mole)\s*$", RegexOptions.Compiled);  
        public static readonly Regex JouleMoleRegex = new Regex(@"^\s*(?:joules?\s*[/]\s*mole)\s*$", RegexOptions.Compiled);  
        public static readonly Regex KelvinRegex = new Regex(@"^\s*(?:kelvins?)\s*$", RegexOptions.Compiled);  

		public CkReactionActivationEnergyUnits(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkReactionActivationEnergyUnits(TextProgressArg arg) : base(arg.Source) { Initialize(arg); }        
		internal CkReactionActivationEnergyUnits(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkReactionActivationEnergyUnits(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

        public ActivationEnergyUnits ActivationEnergyUnits { get; private set; }

        void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
            if(false){}  
            else if( CalMoleRegex.IsMatch(this) ){ this.ActivationEnergyUnits = ActivationEnergyUnits.CalMole; }  
            else if( KiloCalMoleRegex.IsMatch(this) ){ this.ActivationEnergyUnits = ActivationEnergyUnits.KiloCalMole; }  
            else if( JouleMoleRegex.IsMatch(this) ){ this.ActivationEnergyUnits = ActivationEnergyUnits.JouleMole; }  
            else if( KelvinRegex.IsMatch(this) ){ this.ActivationEnergyUnits = ActivationEnergyUnits.Kelvin; }  
            else
            { 
                listener.Submit(TextInfoType.Error, "Invalid format", this);  
            }
        }
    }

    
	 
	public partial class CkScript : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)\s*(?:\s*(?>(?<elem>(?:\belem(?:ents)?\b)(?>(?!$|(?:(\bend\b)|(?:(?:\belem(?:ents)?\b)|(?:\bspec(?:ies)?\b)|(?:\bther(?:mo)?\b)|(?:\breac(?:tions)?\b)))).)*(?>\bend\b)?)|(?<spec>(?:\bspec(?:ies)?\b)(?>(?!$|(?:(\bend\b)|(?:(?:\belem(?:ents)?\b)|(?:\bspec(?:ies)?\b)|(?:\bther(?:mo)?\b)|(?:\breac(?:tions)?\b)))).)*(?>\bend\b)?)|(?<thermo>(?:\bther(?:mo)?\b)(?>(?!$|(?:(\bend\b)|(?:(?:\belem(?:ents)?\b)|(?:\bspec(?:ies)?\b)|(?:\bther(?:mo)?\b)|(?:\breac(?:tions)?\b)))).)*(?>\bend\b)?)|(?<reac>(?:\breac(?:tions)?\b)(?>(?!$|(?:(\bend\b)|(?:(?:\belem(?:ents)?\b)|(?:\bspec(?:ies)?\b)|(?:\bther(?:mo)?\b)|(?:\breac(?:tions)?\b)))).)*(?>\bend\b)?)|(?<defect>\S(?>\s*(?>(?!$|(?:(\bend\b)|(?:(?:\belem(?:ents)?\b)|(?:\bspec(?:ies)?\b)|(?:\bther(?:mo)?\b)|(?:\breac(?:tions)?\b))))\S+))*(?>\s*(?:\bend\b))?))\s*)*\s*)$", RegexOptions.Compiled);
		 
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkElementSet> m_elementSetsCollection = new List<CkElementSet>();  
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkSpeciesSet> m_speciesSetsCollection = new List<CkSpeciesSet>();  
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkThermoSet> m_thermoSetsCollection = new List<CkThermoSet>();  
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkReactionSet> m_reactionSetsCollection = new List<CkReactionSet>();  	
         	
         	
		 	

		public static CkScript Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkScript>(text);
		}


		public CkScript(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkScript(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkScript(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkScript");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}   
				foreach(Capture capture in match.Groups["defect"].Captures)
				{  
					listener.Submit(TextInfoType.Error, "Expected ELEMENTS, SPECIES, THERMO or REACTIONS set", this.Source, capture);  
				}  
				for(int counter = 0; counter < match.Groups["elem"].Captures.Count; ++counter)
				{
					var capture = match.Groups["elem"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <elem> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_elementSetsCollection.Add(new CkElementSet(arg, capture));
				}  
				for(int counter = 0; counter < match.Groups["spec"].Captures.Count; ++counter)
				{
					var capture = match.Groups["spec"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <spec> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_speciesSetsCollection.Add(new CkSpeciesSet(arg, capture));
				}  
				for(int counter = 0; counter < match.Groups["thermo"].Captures.Count; ++counter)
				{
					var capture = match.Groups["thermo"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <thermo> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_thermoSetsCollection.Add(new CkThermoSet(arg, capture));
				}  
				for(int counter = 0; counter < match.Groups["reac"].Captures.Count; ++counter)
				{
					var capture = match.Groups["reac"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <reac> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_reactionSetsCollection.Add(new CkReactionSet(arg, capture));
				}   
				  

				 

				 

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

			

			

			


		 
		 
		public IEnumerable<CkElementSet> ElementSetsCollection
        {
            get  { return new ReadOnlyCollection<CkElementSet>(m_elementSetsCollection); }
        }  
		public IEnumerable<CkSpeciesSet> SpeciesSetsCollection
        {
            get  { return new ReadOnlyCollection<CkSpeciesSet>(m_speciesSetsCollection); }
        }  
		public IEnumerable<CkThermoSet> ThermoSetsCollection
        {
            get  { return new ReadOnlyCollection<CkThermoSet>(m_thermoSetsCollection); }
        }  
		public IEnumerable<CkReactionSet> ReactionSetsCollection
        {
            get  { return new ReadOnlyCollection<CkReactionSet>(m_reactionSetsCollection); }
        }  

		 	 	
	} 
     
	public partial class CkElementSet : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkElementSet Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkElementSet>(text);
		}


		public CkElementSet(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkElementSet(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkElementSet(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkElementSet");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  

				 

				 

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

			

			

			


		 
		 

		 	 	
	} 
     
	public partial class CkSpeciesSet : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)\s*(?:\bspec(?:ies)?\b)\s*(?>(?<spid>(?!\bend\b)\S+)\s*)*(?:\bend\b)?\s*)$", RegexOptions.Compiled);
		 	
         	
         	
		 
		private readonly List<string> m_speciesIDs = new List<string>();  	

		public static CkSpeciesSet Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkSpeciesSet>(text);
		}


		public CkSpeciesSet(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkSpeciesSet(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkSpeciesSet(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkSpeciesSet");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				foreach(Capture capture in match.Groups["spid"].Captures)
				{					
                    m_speciesIDs.Add( capture.Value );
				}  
				  

				 

				 

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

			

			

			


		 
		 

		 	 
		public IEnumerable<string> SpeciesIDs 
		{
			get  { return new ReadOnlyCollection<string>(m_speciesIDs); }
		}  	
	} 
     
	public partial class CkThermoSet : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s)\s*(?:\bther(?:mo)?\b).*?(?=$|(?:(\bend\b)|(?:(?:\belem(?:ents)?\b)|(?:\bspec(?:ies)?\b)|(?:\bther(?:mo)?\b)|(?:\breac(?:tions)?\b))))(?:\bend\b)?\s*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?>\s*)(?>(?:\bther(?:mo)?\b)(?:[^\r\n\S]+(?<option>\S+))*)(?>(?:(?:(?:[^\S\n]*\n)*))*)(?>(?:(?<=[\n])(?=(?>[^\n\r\S]*\S+)(?>(?:[^\n\r\S]+\S+){2})[^\n\r\S]*\r?\n)(?>(?:[^\n\r\S]*(?<deftemp>\S+)){3}))?)(?>(?:(?:(?:[^\S\n]*\n)*))*)(?:(?:(?:(?:[^\S\n]*\n)*))*(?:(?<form>(?<=^|\n)(?=[^\r\n]*[^\s\d])(?:(?:(?=[^\r\n]*[^\s\d])[^\r\n]+)(?:(?:(?:(?:[^\S\n]*\n)*))*(?<=[\n])(?![^\r\n]*\D[^\r\n]{78}[1])(?!\s*\bend\b)(?:[^\r\n]+))+))|(?>(?>\s*)\bend\b\s*$)|(?<defect>(?=[^\n]*\S)[^\n]*(?:(?:(?:(?:[^\S\n]*\n)*))*(?=[^\n]*\S)(?![^\n]{79}[1])[^\n]+(?:(?:(?:(?:[^\S\n]*\n)*))*\s*(?:[+-]?(?:(?>(?:(?:\d+\.?\d*)|(?:\.\d+))(?:[efd][+-]?\d{1,3})?)))[^\n]*)*)*)))*\s*)$", RegexOptions.Compiled);
		 
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkThermoForm> m_thermoItemCollection = new List<CkThermoForm>();  	
         
		private readonly List<ThermoSetOptions> m_thermoSetOptions = new List<ThermoSetOptions>();  	
         
		private readonly List<double> m_defTempCollection = new List<double>();  	
		 	

		public static CkThermoSet Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkThermoSet>(text);
		}


		public CkThermoSet(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkThermoSet(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkThermoSet(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkThermoSet");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}   
				foreach(Capture capture in match.Groups["defect"].Captures)
				{  
					listener.Submit(TextInfoType.Error, "Invalid format", this.Source, capture);  
				}  
				for(int counter = 0; counter < match.Groups["form"].Captures.Count; ++counter)
				{
					var capture = match.Groups["form"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <form> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_thermoItemCollection.Add(new CkThermoForm(arg, capture));
				}   
				foreach(Capture capture in match.Groups["option"].Captures)
				{
					var fragment = new CkThermoSetOptions(arg, capture);
					m_thermoSetOptions.Add( fragment.ThermoSetOptions );
				}
				  
				foreach(Capture capture in match.Groups["deftemp"].Captures)
				{
					double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        m_defTempCollection.Add( @value );
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, capture);
                    }
				}
				  
				  

				 

				 

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

			

			

			


		 
		 
		public IEnumerable<CkThermoForm> ThermoItemCollection
        {
            get  { return new ReadOnlyCollection<CkThermoForm>(m_thermoItemCollection); }
        }  

		 
		public IEnumerable<double> DefTempCollection 
		{
			get  { return new ReadOnlyCollection<double>(m_defTempCollection); }
		}  	 	
	} 
     
	public partial class CkThermoForm : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?:(?:(?:(?:[^\r\n\S]*(?<id>\S+)[^\r\n]*?(?<=[^\r\n]{18}))|(?<id>.{18}))(?<date>.{6})(?:(?:[\s0]{5})|(?<element>(?=\s{0,1}\S).{2}(?=\s{0,2}\S).{3})|(?<elemdefect>.{5})){4}(?<phase>.)(?:(?<tmin>(?!\s{10}).{10})|.{10})(?:(?<tmax>(?!\s{10}).{10})|.{10})(?:(?<tmid>(?!\s{10}).{10})|.{10})(?<white>.{4})[1][^\r\n\S]*(?:(?:(?<element>[a-z]+[^\r\n\S]*(?:[+-]?(?:(?>(?:(?:\d+\.?\d*)|(?:\.\d+))(?:[efd][+-]?\d{1,3})?))))+(?=[^\n\S]*(?:$|\n)))|(?<extras>[^\r\n]*))))(?:(?:[^\S\n]*\n)*)(?:(?<thermo7>(?>(?>\s*\btemp(?:erature)?\b).*)|(?:[^\r\n]{79}[2][^\r\n]*(?:(?:[^\S\n]*\n)*)[^\r\n]{79}[3][^\r\n]*(?:(?:[^\S\n]*\n)*)(?:(?>[^\r\n]{79}[4][^\r\n]*)|(?>[^\r\n]{60}(?:\s*[4]\s*)?))\s*$))|(?<defect>\s*)))$", RegexOptions.Compiled);
		 
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkThermoElement> m_elementsCollection = new List<CkThermoElement>();  	
         	
         	
		 	

		public static CkThermoForm Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkThermoForm>(text);
		}


		public CkThermoForm(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkThermoForm(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkThermoForm(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkThermoForm");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}   
				foreach(Capture capture in match.Groups["elemdefect"].Captures)
				{  
					listener.Submit(TextInfoType.Error, "Expected element amount specification", this.Source, capture);  
				}  
				for(int counter = 0; counter < match.Groups["element"].Captures.Count; ++counter)
				{
					var capture = match.Groups["element"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <element> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_elementsCollection.Add(new CkThermoElement(arg, capture));
				}   
				 	
				for(int counter = 0; counter < match.Groups["phase"].Captures.Count; ++counter)			
				{
					Capture capture = match.Groups["phase"].Captures[counter];
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.Phase = ( new CkThermoPhase(arg, capture) ).PhaseType;					
				}
				  

				 
                for(int counter = 0; counter < match.Groups["id"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["id"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.SpeciesID = arg.MapString(capture.Value.Trim());   
					if( false == Regex.IsMatch(this.SpeciesID, @"^\s*\D\S*\s*$"))
					{
						listener.Submit(TextInfoType.Error, "Invalid species id", this.Source, match.Groups["id"]);
					}  
				}  
                for(int counter = 0; counter < match.Groups["date"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["date"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.Date = arg.MapString(capture.Value.Trim());   
				}  

				 
                for(int counter = 0; counter < match.Groups["tmin"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["tmin"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Tmin = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["tmin"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["tmid"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["tmid"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Tmid = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["tmid"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["tmax"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["tmax"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Tmax = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["tmax"]);
                    }
				}  

										
				 		
				for(int counter = 0; counter < match.Groups["thermo7"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["thermo7"].Captures[counter];
					this.Thermo7Set = new CkThermo7Approximation(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}    
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

		 
		/// <summary>
        /// SpeciesID
        /// </summary>
		public string SpeciesID { get; private set; }   
		/// <summary>
        /// Date
        /// </summary>
		public string Date { get; private set; }  	

			

		 
		/// <summary>
        /// Tmin
        /// </summary>
		public double? Tmin { get; private set; }   
		/// <summary>
        /// Tmid
        /// </summary>
		public double? Tmid { get; private set; }   
		/// <summary>
        /// Tmax
        /// </summary>
		public double? Tmax { get; private set; }  	

			

		 
		/// <summary>
        /// Phase
        /// </summary>
		public PhaseType Phase { get; private set; }  	


		 
		public CkThermo7Approximation Thermo7Set { get; private set; }  
		 
		public IEnumerable<CkThermoElement> ElementsCollection
        {
            get  { return new ReadOnlyCollection<CkThermoElement>(m_elementsCollection); }
        }  

		 	 	
	} 
     
	public partial class CkThermoElement : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:.*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?<id>\S+?)\s*(?<amount>(?:[+-]?(?:(?>(?:(?:\d+\.?\d*)|(?:\.\d+))(?:[efd][+-]?\d{1,3})?)))))$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkThermoElement Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkThermoElement>(text);
		}


		public CkThermoElement(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkThermoElement(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkThermoElement(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkThermoElement");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  

				 
                for(int counter = 0; counter < match.Groups["id"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["id"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.ElementID = arg.MapString(capture.Value.Trim());   
					if( false == Regex.IsMatch(this.ElementID, @"^\s*[a-z]{1,2}\s*$"))
					{
						listener.Submit(TextInfoType.Error, "Invalid element id", this.Source, match.Groups["id"]);
					}  
				}  

				 
                for(int counter = 0; counter < match.Groups["amount"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["amount"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.TotalAmount = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["amount"]);
                    }
				}  

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

		 
		/// <summary>
        /// ElementID
        /// </summary>
		public string ElementID { get; private set; }  	

			

		 
		/// <summary>
        /// TotalAmount
        /// </summary>
		public double TotalAmount { get; private set; }  	

			

			


		 
		 

		 	 	
	} 
     
	public partial class CkThermo7Approximation : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?:(?:(?=\s*\btemp(?:erature)?\b)(?>(?:(?:[^\S\n]*\n)*)*)(?:(?>temp(?:erature)?(?:[^\r\n\S]+(?<temperature>\S+)){2,10})|(?>(?<tempdefect>\S+(?>[^\r\n\S]*\S+)*)))(?>(?>(?<range>(?>(?:(?:[^\S\n]*\n)*))(?>[^\r\n]{15}){5}(?>[^\r\n\S]*)(?>(?<rabish>\S+(?>[^\r\n\S]+\S+)*)?)(?>(?:(?:[^\S\n]*\n)*))(?>[^\r\n]{15}){2}(?>[^\r\n\S]*)(?>(?<rabish>\S+(?>[^\r\n\S]+\S+)*)?)){1,9}(?>\s*)(?>(?<rabish>\S+(?>\s+\S+)))?)|(?>(?>\s*)(?>(?<freeformatnotrange>\S.*)))))|(?:(?:(?:[^\S\n]*\n)*)(?<range>[^\r\n]{79}[2][^\r\n]*\r\n(?:(?:[^\S\n]*\n)*)[^\r\n]{30})(?<range>.*))))$", RegexOptions.Compiled);
		 
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkThermo7Range> m_rangeCollection = new List<CkThermo7Range>();  	
         	
         
		private readonly List<double> m_temperatures = new List<double>();  	
		 	

		public static CkThermo7Approximation Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkThermo7Approximation>(text);
		}


		public CkThermo7Approximation(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkThermo7Approximation(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkThermo7Approximation(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkThermo7Approximation");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}   
				foreach(Capture capture in match.Groups["freeformatnotrange"].Captures)
				{  
					listener.Submit(TextInfoType.Error, "Expected NASA Free Format temperature range coefficients", this.Source, capture);  
				}  
				for(int counter = 0; counter < match.Groups["range"].Captures.Count; ++counter)
				{
					var capture = match.Groups["range"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <range> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_rangeCollection.Add(new CkThermo7Range(arg, capture));
				}   
				foreach(Capture capture in match.Groups["temperature"].Captures)
				{
					double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        m_temperatures.Add( @value );
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, capture);
                    }
				}
				  
				  

				 

				 

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

			

			

			


		 
		 
		public IEnumerable<CkThermo7Range> RangeCollection
        {
            get  { return new ReadOnlyCollection<CkThermo7Range>(m_rangeCollection); }
        }  

		 
		public IEnumerable<double> Temperatures 
		{
			get  { return new ReadOnlyCollection<double>(m_temperatures); }
		}  	 	
	} 
     
	public partial class CkThermo7Range : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?>(?=[^\r\n]{79}[2](?>[^\r\n]*)(?>(?:(?:[^\S\n]*\n)*))[^\r\n]{79}[3]|[^\r\n]{49}[3](?>(?:(?:[^\S\n]*\n)*))[^\r\n]{60})(?>(?:(?:(?:[^\S\n]*\n)*)(?<coefficient>[^\r\n]{15}){5}(?<white>[^\r\n]{4})[2][^\r\n]*(?:(?:[^\S\n]*\n)*)(?<coefficient>[^\r\n]{15}){2})|(?:(?<coefficient>[^\r\n]{15}){3}(?<white>[^\r\n]{4})[3][^\r\n]*(?:(?:[^\S\n]*\n)*)(?<coefficient>[^\r\n]{15}){4}(?>(?:(?<white>[^\r\n]{19})[4][^\r\n]*)|(?:\s+[4]\s*))?\s*)))|(?>(?>(?:(?:[^\S\n]*\n)*))(?>(?>(?<coefficient>[^\r\n]{15}){5})(?>[^\r\n]*)(?>(?:(?:[^\S\n]*\n)*))(?>(?<coefficient>[^\r\n]{15}){2})(?>[^\r\n]*)(?>(?:(?:[^\S\n]*\n)*)))+))$", RegexOptions.Compiled);
		 	
         	
         
		private readonly List<double> m_coefficients = new List<double>();  	
		 	

		public static CkThermo7Range Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkThermo7Range>(text);
		}


		public CkThermo7Range(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkThermo7Range(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkThermo7Range(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkThermo7Range");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				foreach(Capture capture in match.Groups["coefficient"].Captures)
				{
					double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        m_coefficients.Add( @value );
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, capture);
                    }
				}
				  
				  

				 

				 

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

			

			

			


		 
		 

		 
		public IEnumerable<double> Coefficients 
		{
			get  { return new ReadOnlyCollection<double>(m_coefficients); }
		}  	 	
	} 
     
	public partial class CkReactionSet : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?>\s*)(?:\breac(?:tions)?\b)(?>(?>(?>[^\r\n\S]*)(?>(?<option>\b(?>noncon|mwon|mwoff)\b)|(?<actunits>\b(?>(?>[a-z]+[^\r\n\S]*[/][^\r\n\S]*[a-z]+)|kelvins?)\b)|(?<molamountunits>\b(?>k?moles?|molecules?)\b)|(?<energyuntunits>\b(?>k?cal|joules?)\b)|(?<optiondefect>\S+)))*)(?>\s*)(?>(?>(?>(?>\s*))(?>(?<begin>(?=\S))(?>[^\r\n]+)(?>(?>(?>\s*)(?=\S)(?!(?>[^\r\n=]+)[=])(?>[^\r\n]+)(?>\s*))*)(?<reaction-begin>(?>\s*))))*)(?>\s*))$", RegexOptions.Compiled);
		 
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkReaction> m_reactions = new List<CkReaction>();  	
         
		private readonly List<ReactionSetOptions> m_options = new List<ReactionSetOptions>();  	
         	
		 	

		public static CkReactionSet Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkReactionSet>(text);
		}


		public CkReactionSet(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkReactionSet(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkReactionSet(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkReactionSet");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}    
				for(int counter = 0; counter < match.Groups["reaction"].Captures.Count; ++counter)
				{
					var capture = match.Groups["reaction"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <reaction> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_reactions.Add(new CkReaction(arg, capture));
				}   
				foreach(Capture capture in match.Groups["option"].Captures)
				{
					var fragment = new CkReactionSetOptions(arg, capture);
					m_options.Add( fragment.ReactionSetOptions );
				}
				  
				 	
				for(int counter = 0; counter < match.Groups["actunits"].Captures.Count; ++counter)			
				{
					Capture capture = match.Groups["actunits"].Captures[counter];
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.ActivationEnergyUnits = ( new CkReactionActivationEnergyUnits(arg, capture) ).ActivationEnergyUnits;					
				}
				 	
				for(int counter = 0; counter < match.Groups["molamountunits"].Captures.Count; ++counter)			
				{
					Capture capture = match.Groups["molamountunits"].Captures[counter];
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.MolAmountUnits = ( new CkReactionMolAmountUnits(arg, capture) ).ReactionMolAmountUnits;					
				}
				 	
				for(int counter = 0; counter < match.Groups["energyuntunits"].Captures.Count; ++counter)			
				{
					Capture capture = match.Groups["energyuntunits"].Captures[counter];
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.EnergyUnits = ( new CkReactionEnergyUnits(arg, capture) ).ReactionEnergyUnits;					
				}
				  

				 

				 

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

			

			

		 
		/// <summary>
        /// ActivationEnergyUnits
        /// </summary>
		public ActivationEnergyUnits? ActivationEnergyUnits { get; private set; }   
		/// <summary>
        /// MolAmountUnits
        /// </summary>
		public ReactionMolAmountUnits? MolAmountUnits { get; private set; }   
		/// <summary>
        /// EnergyUnits
        /// </summary>
		public ReactionEnergyUnits? EnergyUnits { get; private set; }  	


		 
		 
		public IEnumerable<CkReaction> Reactions
        {
            get  { return new ReadOnlyCollection<CkReaction>(m_reactions); }
        }  

		 	 	
	} 
     
	public partial class CkReaction : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?>\s*)(?=\S)(?>(?<equation>(?>[^=]+=)(?>\s*\S*)[^\r\n]*?)(?<fwd>(?>\s+\S+){3})[^\S\r\n]*(?:$|\r?\n))(?>\s*)(?>(?>(?>\s*)(?=\S)(?!\bend\b)(?>(?<open>(?>\blow\b\s*[/]))(?>[^/]+)(?<low-open>[/])?|(?<open>(?>\brev\b\s*[/]))(?>[^/]+)(?<rev-open>[/])?|(?<open>(?>\bhigh\b\s*[/]))(?>[^/]+)(?<high-open>[/])?|(?<open>(?>\btroe\b\s*[/]))(?>[^/]+)(?<troe-open>[/])?|(?<open>(?>\bsri\b\s*[/]))(?>[^/]+)(?<sri-open>[/])?|(?<open>(?>\blt\b\s*[/]))(?>[^/]+)(?<lt-open>[/])?|(?<open>(?>\brlt\b\s*[/]))(?>[^/]+)(?<rlt-open>[/])?|(?<open>(?>\bjan\b\s*[/]))(?>[^/]+)(?<jan-open>[/])?|(?<open>(?>\bfit1\b\s*[/]))(?>[^/]+)(?<fit1-open>[/])?|(?<open>(?>\bhv\b\s*[/]))(?>[^/]+)(?<hv-open>[/])?|(?<open>(?>\btdep\b\s*[/]))(?>[^/]+)(?<tdep-open>[/])?|(?<open>(?>\bford\b\s*[/]))(?>[^/]+)(?<ford-open>[/])?|(?<open>(?>\brord\b\s*[/]))(?>[^/]+)(?<rord-open>[/])?|(?<open>(?>\bexci\b\s*[/]))(?>[^/]+)(?<exci-open>[/])?|(?<hv>(?>\bhv\b))|(?<mome>(?>\bmome\b))|(?<xsmi>(?>\bxsmi\b))|(?<duplicate>(?>\bdup(?:licate)?\b))|(?<enhanced>(?>[^\s/]+(?>\s*)[/](?>\s*)(?:(?>(?:(?:\d+\.?\d*)|(?:\.\d+))(?:[efd][+-]?\d{1,3})?))(?>\s*)[/]))|(?<auxdefect>\S+))(?>\s*))*)(?>\s*)(?>\bend\b\s*$)?)$", RegexOptions.Compiled);
		 
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkReagentOrder> m_ford = new List<CkReagentOrder>();  
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkReagentOrder> m_rord = new List<CkReagentOrder>();  
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkEnhanced> m_enhanced = new List<CkEnhanced>();  	
         	
         	
		 	

		public static CkReaction Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkReaction>(text);
		}


		public CkReaction(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkReaction(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkReaction(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkReaction");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}   
				foreach(Capture capture in match.Groups["auxdefect"].Captures)
				{  
					listener.Submit(TextInfoType.Error, "Invalid auxilary data format", this.Source, capture);  
				}  
				for(int counter = 0; counter < match.Groups["ford"].Captures.Count; ++counter)
				{
					var capture = match.Groups["ford"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <ford> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_ford.Add(new CkReagentOrder(arg, capture));
				}  
				for(int counter = 0; counter < match.Groups["rord"].Captures.Count; ++counter)
				{
					var capture = match.Groups["rord"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <rord> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_rord.Add(new CkReagentOrder(arg, capture));
				}  
				for(int counter = 0; counter < match.Groups["enhanced"].Captures.Count; ++counter)
				{
					var capture = match.Groups["enhanced"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <enhanced> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_enhanced.Add(new CkEnhanced(arg, capture));
				}   
				  
				if( match.Groups["duplicate"].Success 
					&& Regex.IsMatch( match.Groups["duplicate"].Value, @"^(?:.*)$") )
				{
					this.IsDuplicate = true;
				}
				 
				if( match.Groups["mome"].Success 
					&& Regex.IsMatch( match.Groups["mome"].Value, @"^(?:.*)$") )
				{
					this.Mome = true;
				}
				 
				if( match.Groups["xsmi"].Success 
					&& Regex.IsMatch( match.Groups["xsmi"].Value, @"^(?:.*)$") )
				{
					this.Xsmi = true;
				}
				 

				 

				 

										
				 		
				for(int counter = 0; counter < match.Groups["equation"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["equation"].Captures[counter];
					this.ReactionEquation = new CkEquation(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}  		
				for(int counter = 0; counter < match.Groups["fwd"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["fwd"].Captures[counter];
					this.FwdConstant = new CkArrhenius(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}  		
				for(int counter = 0; counter < match.Groups["rev"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["rev"].Captures[counter];
					this.RevConstant = new CkArrhenius(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}  		
				for(int counter = 0; counter < match.Groups["low"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["low"].Captures[counter];
					this.Low = new CkArrhenius(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}  		
				for(int counter = 0; counter < match.Groups["high"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["high"].Captures[counter];
					this.High = new CkArrhenius(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}  		
				for(int counter = 0; counter < match.Groups["troe"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["troe"].Captures[counter];
					this.Troe = new CkTroe(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}  		
				for(int counter = 0; counter < match.Groups["sri"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["sri"].Captures[counter];
					this.Sri = new CkSri(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}  		
				for(int counter = 0; counter < match.Groups["lt"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["lt"].Captures[counter];
					this.FwdLandauTeller = new CkLandauTeller(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}  		
				for(int counter = 0; counter < match.Groups["rlt"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["rlt"].Captures[counter];
					this.RevLandauTeller = new CkLandauTeller(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}  		
				for(int counter = 0; counter < match.Groups["exci"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["exci"].Captures[counter];
					this.Exci = new CkExci(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}  		
				for(int counter = 0; counter < match.Groups["tdep"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["tdep"].Captures[counter];
					this.TDep = new CkTDep(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}    
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

			

		 
		/// <summary>
        /// IsDuplicate
        /// </summary>
		public bool IsDuplicate { get; private set; }   
		/// <summary>
        /// Mome
        /// </summary>
		public bool Mome { get; private set; }   
		/// <summary>
        /// Xsmi
        /// </summary>
		public bool Xsmi { get; private set; }  	

			


		 
		public CkEquation ReactionEquation { get; private set; }  
		public CkArrhenius FwdConstant { get; private set; }  
		public CkArrhenius RevConstant { get; private set; }  
		public CkArrhenius Low { get; private set; }  
		public CkArrhenius High { get; private set; }  
		public CkTroe Troe { get; private set; }  
		public CkSri Sri { get; private set; }  
		public CkLandauTeller FwdLandauTeller { get; private set; }  
		public CkLandauTeller RevLandauTeller { get; private set; }  
		public CkExci Exci { get; private set; }  
		public CkTDep TDep { get; private set; }  
		 
		public IEnumerable<CkReagentOrder> Ford
        {
            get  { return new ReadOnlyCollection<CkReagentOrder>(m_ford); }
        }  
		public IEnumerable<CkReagentOrder> Rord
        {
            get  { return new ReadOnlyCollection<CkReagentOrder>(m_rord); }
        }  
		public IEnumerable<CkEnhanced> Enhanced
        {
            get  { return new ReadOnlyCollection<CkEnhanced>(m_enhanced); }
        }  

		 	 	
	} 
     
	public partial class CkEquation : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?>\s*)(?<fwd>(?>(?![<]?(?>\s*)[=])(?![(](?>\s*)[+](?>\s*)[^)\s]+(?>\s*)[)]).)+)(?>\s*)(?>[(](?>\s*)[+](?>\s*)(?<thbody>[^)\s]+)(?>\s*)[)])?(?>\s*)(?<arrow>[<](?>\s*)[=](?>\s*)[>]|[=](?>\s*)(?>[>]?))(?<rev>(?>(?(thbody)(?![(](?>\s*)[+](?>\s*)\k<thbody>(?>\s*)[)])).)+)(?>[(](?>\s*)[+](?>\s*)\k<thbody>(?>\s*)[)])?(?>\s*))$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkEquation Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkEquation>(text);
		}


		public CkEquation(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkEquation(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkEquation(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkEquation");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  
				if( match.Groups["arrow"].Success 
					&& Regex.IsMatch( match.Groups["arrow"].Value, @"^(?:[<]\s*[=].*|\s*[=]\s*)$") )
				{
					this.IsReversible = true;
				}
				 

				 
                for(int counter = 0; counter < match.Groups["thbody"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["thbody"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.ThirdBody = arg.MapString(capture.Value);   
				}  

				 

										
				 		
				for(int counter = 0; counter < match.Groups["fwd"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["fwd"].Captures[counter];
					this.FwdReaction = new CkSynthesis(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}  		
				for(int counter = 0; counter < match.Groups["rev"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["rev"].Captures[counter];
					this.RevReaction = new CkSynthesis(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}    
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

		 
		/// <summary>
        /// ThirdBody
        /// </summary>
		public string ThirdBody { get; private set; }  	

			

			

		 
		/// <summary>
        /// IsReversible
        /// </summary>
		public bool IsReversible { get; private set; }  	

			


		 
		public CkSynthesis FwdReaction { get; private set; }  
		public CkSynthesis RevReaction { get; private set; }  
		 

		 	 	
	} 
     
	public partial class CkSynthesis : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?>\s*)(?>(?>\s*)(?=\S)(?<open>)(?:(?:[+]?(?:(?>(?:(?:\d+\.?\d*)|(?:\.\d+))(?:[efd][+-]?\d{1,3})?))))?(?>(?>[^+]|[+](?>\s*)(?=$|[+]))+)(?<reagent-open>\s*[+]\s*|$))+(?>\s*))$", RegexOptions.Compiled);
		 
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkReagent> m_reagents = new List<CkReagent>();  	
         	
         	
		 	

		public static CkSynthesis Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkSynthesis>(text);
		}


		public CkSynthesis(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkSynthesis(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkSynthesis(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkSynthesis");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}    
				for(int counter = 0; counter < match.Groups["reagent"].Captures.Count; ++counter)
				{
					var capture = match.Groups["reagent"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <reagent> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_reagents.Add(new CkReagent(arg, capture));
				}   
				  

				 

				 

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

			

			

			


		 
		 
		public IEnumerable<CkReagent> Reagents
        {
            get  { return new ReadOnlyCollection<CkReagent>(m_reagents); }
        }  

		 	 	
	} 
     
	public partial class CkReagent : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?>\s*)(?:(?<coef>(?:[+]?(?:(?>(?:(?:\d+\.?\d*)|(?:\.\d+))(?:[efd][+-]?\d{1,3})?))))(?>\s*))?(?>(?<id>\S+(\s+\S+)*))(?>\s*))$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkReagent Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkReagent>(text);
		}


		public CkReagent(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkReagent(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkReagent(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkReagent");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  

				 
                for(int counter = 0; counter < match.Groups["id"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["id"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.ReagentID = arg.MapString(capture.Value);   
				}  

				 
                for(int counter = 0; counter < match.Groups["coef"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["coef"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Coefficient = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["coef"]);
                    }
				}  

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

		 
		/// <summary>
        /// ReagentID
        /// </summary>
		public string ReagentID { get; private set; }  	

			

		 
		/// <summary>
        /// Coefficient
        /// </summary>
		public double? Coefficient { get; private set; }  	

			

			


		 
		 

		 	 	
	} 
     
	public partial class CkArrhenius : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?>\s*)(?<a>(?>\S+))(?>\s+)(?<b>(?>\S+))(?>\s+)(?<c>(?>\S+))(?>\s*))$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkArrhenius Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkArrhenius>(text);
		}


		public CkArrhenius(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkArrhenius(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkArrhenius(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkArrhenius");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  

				 

				 
                for(int counter = 0; counter < match.Groups["a"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["a"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefA = value; 
					    if( this.CoefA < 0 )
					    {
						    listener.Submit(TextInfoType.Error, "Expected value >= 0", this.Source, capture);
					    }    
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["a"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["b"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["b"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefB = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["b"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["c"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["c"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefC = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["c"]);
                    }
				}  

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

		 
		/// <summary>
        /// CoefA
        /// </summary>
		public double CoefA { get; private set; }   
		/// <summary>
        /// CoefB
        /// </summary>
		public double CoefB { get; private set; }   
		/// <summary>
        /// CoefC
        /// </summary>
		public double CoefC { get; private set; }  	

			

			


		 
		 

		 	 	
	} 
     
	public partial class CkTroe : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?>\s*)(?<a>\S+)(?>\s*)(?<b>\S+)(?>\s*)(?<c>\S+)(?>\s*)(?<d>\S+)?(?>\s*))$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkTroe Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkTroe>(text);
		}


		public CkTroe(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkTroe(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkTroe(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkTroe");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  

				 

				 
                for(int counter = 0; counter < match.Groups["a"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["a"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefA = value; 
					    if( this.CoefA < 0 )
					    {
						    listener.Submit(TextInfoType.Error, "Expected value >= 0", this.Source, capture);
					    }    
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["a"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["b"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["b"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefB = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["b"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["c"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["c"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefC = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["c"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["d"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["d"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefD = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["d"]);
                    }
				}  

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

		 
		/// <summary>
        /// CoefA
        /// </summary>
		public double CoefA { get; private set; }   
		/// <summary>
        /// CoefB
        /// </summary>
		public double CoefB { get; private set; }   
		/// <summary>
        /// CoefC
        /// </summary>
		public double CoefC { get; private set; }   
		/// <summary>
        /// CoefD
        /// </summary>
		public double? CoefD { get; private set; }  	

			

			


		 
		 

		 	 	
	} 
     
	public partial class CkSri : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:\s*(?<a>\S+)\s*(?<b>\S+)\s*(?<c>\S+)\s*(?:\s*(?<d>\S+)\s*(?<e>\S+)\s*)?\s*)$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkSri Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkSri>(text);
		}


		public CkSri(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkSri(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkSri(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkSri");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  

				 

				 
                for(int counter = 0; counter < match.Groups["a"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["a"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefA = value; 
					    if( this.CoefA < 0 )
					    {
						    listener.Submit(TextInfoType.Error, "Expected value >= 0", this.Source, capture);
					    }    
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["a"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["b"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["b"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefB = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["b"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["c"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["c"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefC = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["c"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["d"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["d"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefD = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["d"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["e"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["e"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefE = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["e"]);
                    }
				}  

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

		 
		/// <summary>
        /// CoefA
        /// </summary>
		public double CoefA { get; private set; }   
		/// <summary>
        /// CoefB
        /// </summary>
		public double CoefB { get; private set; }   
		/// <summary>
        /// CoefC
        /// </summary>
		public double CoefC { get; private set; }   
		/// <summary>
        /// CoefD
        /// </summary>
		public double? CoefD { get; private set; }   
		/// <summary>
        /// CoefE
        /// </summary>
		public double? CoefE { get; private set; }  	

			

			


		 
		 

		 	 	
	} 
     
	public partial class CkReagentOrder : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?>\s*)(?<id>\S+)(?>\s+)(?<order>\S+)(?>\s*))$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkReagentOrder Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkReagentOrder>(text);
		}


		public CkReagentOrder(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkReagentOrder(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkReagentOrder(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkReagentOrder");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  

				 
                for(int counter = 0; counter < match.Groups["id"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["id"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.SpeciesID = arg.MapString(capture.Value);   
				}  

				 
                for(int counter = 0; counter < match.Groups["order"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["order"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Order = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["order"]);
                    }
				}  

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

		 
		/// <summary>
        /// SpeciesID
        /// </summary>
		public string SpeciesID { get; private set; }  	

			

		 
		/// <summary>
        /// Order
        /// </summary>
		public double Order { get; private set; }  	

			

			


		 
		 

		 	 	
	} 
     
	public partial class CkLandauTeller : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:\s*(?<a>\S+)\s*(?<b>\S+)\s*)$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkLandauTeller Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkLandauTeller>(text);
		}


		public CkLandauTeller(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkLandauTeller(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkLandauTeller(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkLandauTeller");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  

				 

				 
                for(int counter = 0; counter < match.Groups["a"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["a"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefA = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["a"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["b"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["b"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.CoefB = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["b"]);
                    }
				}  

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

		 
		/// <summary>
        /// CoefA
        /// </summary>
		public double CoefA { get; private set; }   
		/// <summary>
        /// CoefB
        /// </summary>
		public double CoefB { get; private set; }  	

			

			


		 
		 

		 	 	
	} 
     
	public partial class CkEnhanced : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:\s*(?>(?<id>[^\s/]+)\s*[/]\s*(?<value>[^\s/]+)\s*[/])\s*)$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkEnhanced Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkEnhanced>(text);
		}


		public CkEnhanced(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkEnhanced(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkEnhanced(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkEnhanced");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  

				 
                for(int counter = 0; counter < match.Groups["id"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["id"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.ReagentID = arg.MapString(capture.Value);   
				}  

				 
                for(int counter = 0; counter < match.Groups["value"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["value"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Coefficient = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["value"]);
                    }
				}  

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

		 
		/// <summary>
        /// ReagentID
        /// </summary>
		public string ReagentID { get; private set; }  	

			

		 
		/// <summary>
        /// Coefficient
        /// </summary>
		public double Coefficient { get; private set; }  	

			

			


		 
		 

		 	 	
	} 
     
	public partial class CkTDep : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?<id>\S+))$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkTDep Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkTDep>(text);
		}


		public CkTDep(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkTDep(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkTDep(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkTDep");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  

				 
                for(int counter = 0; counter < match.Groups["id"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["id"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.SpeciesID = arg.MapString(capture.Value);   
				}  

				 

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

		 
		/// <summary>
        /// SpeciesID
        /// </summary>
		public string SpeciesID { get; private set; }  	

			

			

			

			


		 
		 

		 	 	
	} 
     
	public partial class CkExci : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?>\s*)(?<value>\S+)(?>\s*))$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkExci Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkExci>(text);
		}


		public CkExci(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkExci(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkExci(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkExci");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  

				 

				 
                for(int counter = 0; counter < match.Groups["value"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["value"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Value = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["value"]);
                    }
				}  

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

		 
		/// <summary>
        /// Value
        /// </summary>
		public double Value { get; private set; }  	

			

			


		 
		 

		 	 	
	} 
     
	public partial class CkTransportSet : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?>(?>\s*)(?<values>\S[^\r\n]*))*(?>\s*))$", RegexOptions.Compiled);
		 
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<CkTransportItem> m_items = new List<CkTransportItem>();  	
         	
         	
		 	

		public static CkTransportSet Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkTransportSet>(text);
		}


		public CkTransportSet(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkTransportSet(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkTransportSet(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkTransportSet");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}    
				for(int counter = 0; counter < match.Groups["values"].Captures.Count; ++counter)
				{
					var capture = match.Groups["values"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <values> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_items.Add(new CkTransportItem(arg, capture));
				}   
				  

				 

				 

										
				   
				   
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

			

			

			


		 
		 
		public IEnumerable<CkTransportItem> Items
        {
            get  { return new ReadOnlyCollection<CkTransportItem>(m_items); }
        }  

		 	 	
	} 
     
	public partial class CkTransportItem : CkTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?>\s*)(?<id>\S+)(?>\s+)(?<index>\S+)(?>\s+)(?<epsilon>\S+)(?>\s+)(?<sigma>\S+)(?>\s+)(?<mu>\S+)(?>\s+)(?<alpha>\S+)(?>\s+)(?<zrot>\S+)(?>\s*))$", RegexOptions.Compiled);
		 	
         	
         	
		 	

		public static CkTransportItem Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<CkTransportItem>(text);
		}


		public CkTransportItem(CkTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal CkTransportItem(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal CkTransportItem(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		
		partial void OnInitialized();
		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("CkTransportItem");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				  

				 
                for(int counter = 0; counter < match.Groups["id"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["id"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, capture);
					}
					this.SpeciesID = arg.MapString(capture.Value);   
				}  

				 
                for(int counter = 0; counter < match.Groups["alpha"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["alpha"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Alpha = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["alpha"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["epsilon"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["epsilon"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Epsilon = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["epsilon"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["mu"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["mu"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Mu = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["mu"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["sigma"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["sigma"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Sigma = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["sigma"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["zrot"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["zrot"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Zrot = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["zrot"]);
                    }
				}  

										
				   
				 		
				for(int counter = 0; counter < match.Groups["index"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["index"].Captures[counter];
					this.GeometryIndex = int.Parse( capture.Value );
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}    
				OnInitialized();
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

		 
		/// <summary>
        /// SpeciesID
        /// </summary>
		public string SpeciesID { get; private set; }  	

		 
		/// <summary>
        /// An index indicating whether the molecule has a monatomic, linear or nonlinear geometrical configuration. If the index is 0, the molecule is a single atom. If the index is 1 the molecule is linear, and if it is 2, the molecule is nonlinear.
        /// </summary>
		public int GeometryIndex { get; private set; }  	

		 
		/// <summary>
        /// Polarizability a in cubic angstroms
        /// </summary>
		public double Alpha { get; private set; }   
		/// <summary>
        /// The Lennard-Jones well depth in Kelvins
        /// </summary>
		public double Epsilon { get; private set; }   
		/// <summary>
        /// Dipole moment m in Debyes
        /// </summary>
		public double Mu { get; private set; }   
		/// <summary>
        /// Lennard-Jones collision diameter in Angstroms
        /// </summary>
		public double Sigma { get; private set; }   
		/// <summary>
        /// Rotational relaxation collision number
        /// </summary>
		public double Zrot { get; private set; }  	

			

			


		 
		 

		 	 	
	} 
    

}